package com.carassistant.beta.music.dialog;

import com.carassistant.beta.R;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;

/**
 * @fMessageAnimDialog.java 自定义对话框类
 * @author thinkpad
 * @time2014-1-22
 * 
 */
public class MessageAnimDialog extends Dialog {

	private OnTVAnimDialogDismissListener listener;
	private int dialogId = 0;
	private String title="";
	private String content="";
	private int layoutId=0;
	protected MessageAnimDialog(Context context, boolean cancelable,
			OnCancelListener cancelListener) {
		super(context, cancelable, cancelListener);
	}

	public void setOnMessagenimDialogDismissListener(
			OnTVAnimDialogDismissListener listener) {
		this.listener = listener;
	}
	

	public MessageAnimDialog(Context context,
			OnTVAnimDialogDismissListener listener, int dialogId, String title,
			String content,int layouId) {
		super(context);
		this.listener = listener;
		this.dialogId = dialogId;
		this.title = title;
		this.content = content;
		this.layoutId=layouId;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getWindow().setWindowAnimations(R.style.MessAnimDialogWindowAnim);// 此处附上Dialog动画
	}

	/**
	 * @param dialog
	 *            设置对话框点击处罚按钮的id
	 */
	public void setDialogId(int dialogId) {
		this.dialogId = dialogId;
	}

	@Override
	public void dismiss() {
		super.dismiss();
		if (listener != null) {
			listener.onDismiss(dialogId);
		}
	}

}
